import fly from '../request'
import { isTest } from '../config'
import tools from '../tools'

let baseHost = [
	'http://101.69.143.198:8083/OneCard/Api/',
	'https://service.jktz.gov.cn/gatewayAPI/OneCard/Api'
]

let host = tools.chooseHost(baseHost)

let oneCardPost = (api, params) => {
	return new Promise((resolve, reject) => {
		fly
			.post(host + api, params, {
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				}
			})
			.then(response => {
				resolve(response)
			})
			.catch(error => {
				reject(error)
			})
	})
}

let judgeHouseholdRegister = params => {
	return oneCardPost('/ocpData/householdRegistrationAuth2v', params)
}

export default {
	judgeHouseholdRegister //判断是否同一户籍
}
